1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module adw.TimedAnimation; 26 27 private import adw.Animation; 28 private import adw.AnimationTarget; 29 private import adw.c.functions; 30 public import adw.c.types; 31 private import glib.ConstructionException; 32 private import gobject.ObjectG; 33 private import gtk.Widget; 34 35 36 /** 37 * A time-based [class@Animation]. 38 * 39 * `AdwTimedAnimation` implements a simple animation interpolating the given 40 * value from [property@TimedAnimation:value-from] to 41 * [property@TimedAnimation:value-to] over 42 * [property@TimedAnimation:duration] milliseconds using the curve described by 43 * [property@TimedAnimation:easing]. 44 * 45 * If [property@TimedAnimation:reverse] is set to `TRUE`, `AdwTimedAnimation` 46 * will instead animate from [property@TimedAnimation:value-to] to 47 * [property@TimedAnimation:value-from], and the easing curve will be inverted. 48 * 49 * The animation can repeat a certain amount of times, or endlessly, depending 50 * on the [property@TimedAnimation:repeat-count] value. If 51 * [property@TimedAnimation:alternate] is set to `TRUE`, it will also change the 52 * direction every other iteration. 53 * 54 * Since: 1.0 55 */ 56 public class TimedAnimation : Animation 57 { 58 /** the main Gtk struct */ 59 protected AdwTimedAnimation* adwTimedAnimation; 60 61 /** Get the main Gtk struct */ 62 public AdwTimedAnimation* getTimedAnimationStruct(bool transferOwnership = false) 63 { 64 if (transferOwnership) 65 ownedRef = false; 66 return adwTimedAnimation; 67 } 68 69 /** the main Gtk struct as a void* */ 70 protected override void* getStruct() 71 { 72 return cast(void*)adwTimedAnimation; 73 } 74 75 /** 76 * Sets our main struct and passes it to the parent class. 77 */ 78 public this (AdwTimedAnimation* adwTimedAnimation, bool ownedRef = false) 79 { 80 this.adwTimedAnimation = adwTimedAnimation; 81 super(cast(AdwAnimation*)adwTimedAnimation, ownedRef); 82 } 83 84 85 /** */ 86 public static GType getType() 87 { 88 return adw_timed_animation_get_type(); 89 } 90 91 /** 92 * Creates a new `AdwTimedAnimation` on @widget to animate @target from @from 93 * to @to. 94 * 95 * Params: 96 * widget = a widget to create animation on 97 * from = a value to animate from 98 * to = a value to animate to 99 * duration = a duration for the animation 100 * target = a target value to animate 101 * 102 * Returns: the newly created animation 103 * 104 * Since: 1.0 105 * 106 * Throws: ConstructionException GTK+ fails to create the object. 107 */ 108 public this(Widget widget, double from, double to, uint duration, AnimationTarget target) 109 { 110 auto __p = adw_timed_animation_new((widget is null) ? null : widget.getWidgetStruct(), from, to, duration, (target is null) ? null : target.getAnimationTargetStruct()); 111 112 if(__p is null) 113 { 114 throw new ConstructionException("null returned by new"); 115 } 116 117 this(cast(AdwTimedAnimation*) __p); 118 } 119 120 /** 121 * Gets whether @self changes direction on every iteration. 122 * 123 * Returns: whether @self alternates 124 * 125 * Since: 1.0 126 */ 127 public bool getAlternate() 128 { 129 return adw_timed_animation_get_alternate(adwTimedAnimation) != 0; 130 } 131 132 /** 133 * Gets the duration of @self. 134 * 135 * Returns: the duration of @self, in milliseconds 136 * 137 * Since: 1.0 138 */ 139 public uint getDuration() 140 { 141 return adw_timed_animation_get_duration(adwTimedAnimation); 142 } 143 144 /** 145 * Gets the easing function @self uses. 146 * 147 * Returns: the easing function @self uses 148 * 149 * Since: 1.0 150 */ 151 public AdwEasing getEasing() 152 { 153 return adw_timed_animation_get_easing(adwTimedAnimation); 154 } 155 156 /** 157 * Gets the number of times @self will play. 158 * 159 * Returns: the number of times @self will play 160 * 161 * Since: 1.0 162 */ 163 public uint getRepeatCount() 164 { 165 return adw_timed_animation_get_repeat_count(adwTimedAnimation); 166 } 167 168 /** 169 * Gets whether @self plays backwards. 170 * 171 * Returns: whether @self plays backwards 172 * 173 * Since: 1.0 174 */ 175 public bool getReverse() 176 { 177 return adw_timed_animation_get_reverse(adwTimedAnimation) != 0; 178 } 179 180 /** 181 * Gets the value @self will animate from. 182 * 183 * Returns: the value to animate from 184 * 185 * Since: 1.0 186 */ 187 public double getValueFrom() 188 { 189 return adw_timed_animation_get_value_from(adwTimedAnimation); 190 } 191 192 /** 193 * Gets the value @self will animate to. 194 * 195 * Returns: the value to animate to 196 * 197 * Since: 1.0 198 */ 199 public double getValueTo() 200 { 201 return adw_timed_animation_get_value_to(adwTimedAnimation); 202 } 203 204 /** 205 * Sets whether @self changes direction on every iteration. 206 * 207 * Params: 208 * alternate = whether @self alternates 209 * 210 * Since: 1.0 211 */ 212 public void setAlternate(bool alternate) 213 { 214 adw_timed_animation_set_alternate(adwTimedAnimation, alternate); 215 } 216 217 /** 218 * Sets the duration of @self. 219 * 220 * If the animation repeats more than once, sets the duration of one iteration. 221 * 222 * Params: 223 * duration = the duration to use, in milliseconds 224 * 225 * Since: 1.0 226 */ 227 public void setDuration(uint duration) 228 { 229 adw_timed_animation_set_duration(adwTimedAnimation, duration); 230 } 231 232 /** 233 * Sets the easing function @self will use. 234 * 235 * See [enum@Easing] for the description of specific easing functions. 236 * 237 * Params: 238 * easing = the easing function to use 239 * 240 * Since: 1.0 241 */ 242 public void setEasing(AdwEasing easing) 243 { 244 adw_timed_animation_set_easing(adwTimedAnimation, easing); 245 } 246 247 /** 248 * Sets the number of times @self will play. 249 * 250 * If set to 0, @self will repeat endlessly. 251 * 252 * Params: 253 * repeatCount = the number of times @self will play 254 * 255 * Since: 1.0 256 */ 257 public void setRepeatCount(uint repeatCount) 258 { 259 adw_timed_animation_set_repeat_count(adwTimedAnimation, repeatCount); 260 } 261 262 /** 263 * Sets whether @self plays backwards. 264 * 265 * Params: 266 * reverse = whether @self plays backwards 267 * 268 * Since: 1.0 269 */ 270 public void setReverse(bool reverse) 271 { 272 adw_timed_animation_set_reverse(adwTimedAnimation, reverse); 273 } 274 275 /** 276 * Sets the value @self will animate from. 277 * 278 * Params: 279 * value = the value to animate from 280 * 281 * Since: 1.0 282 */ 283 public void setValueFrom(double value) 284 { 285 adw_timed_animation_set_value_from(adwTimedAnimation, value); 286 } 287 288 /** 289 * Sets the value @self will animate to. 290 * 291 * Params: 292 * value = the value to animate to 293 * 294 * Since: 1.0 295 */ 296 public void setValueTo(double value) 297 { 298 adw_timed_animation_set_value_to(adwTimedAnimation, value); 299 } 300 }